package com.itogis.rest.dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Component;

import com.itogis.rest.po.SysImages;

@Component
public class ImageDao extends BaseDao {
	public List<SysImages> list() {
		List<SysImages> l =new ArrayList();
		String sql = " select  *  from  sys_images ";
		Connection con = this.getConnection();
		Statement st = null;
		ResultSet rs = null;
		try {
			st = con.createStatement();
			rs = st.executeQuery(sql);
			while (rs.next()) {
				SysImages img = new SysImages();
				img.setId(rs.getInt("id"));
				img.setImageName(rs.getString("imagename"));
				img.setImagePath(rs.getString("imagepath"));
				l.add(img);
			}  
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		} finally {
			this.closeConnection(rs, st, con);
		}
		return l;
	}
}
